home *** CD-ROM | disk | FTP | other *** search
- Path: news1.h1.usa.pipeline.com!usenet
- From: grantp@usa.pipeline.com(Pete)
- Newsgroups: comp.lang.c++
- Subject: Re: Help! Need a circle function taking float angle arguements
- Date: 17 Jan 1996 00:37:53 GMT
- Organization: Kalevi, Inc.
- Message-ID: <4dhgd1$ao@news1.usa.pipeline.com>
- NNTP-Posting-Host: pipe4.h1.usa.pipeline.com
- X-PipeUser: grantp
- X-PipeHub: usa.pipeline.com
- X-PipeGCOS: (Pete)
- X-Newsreader: Pipeline USA v3.3.0
-
- On Jan 16, 1996 18:43:10 in article <Help! Need a circle function taking
- float angle arguements>, 'Dave Nulton <dnult@axiom.net>' wrote:
-
-
- >I need a function that plots a circle on the screen in Borland
- >Turbo C++. The graphics.h file contains a function circle that
- >takes an int x and y origin and int start and end angles. The
- >problem is that I need float start and end angles.
- >
- >I figure I can write a function using the putpixel function.
- >However, being an inexperienced programmer, I would much perfer to
- >find an existing library with the function I need.
- >
- >Does anyone know of such a library, or should I start writing that
- >putpixel version
-
- What about converting your floats to integers? If the library wants
- angles based on 360 and your floats are also, it's a simple
-
- WARNING: Untested code follows:
-
- circlefunction(x, y, (int)fStartAngle, (int)fEndAngle);
-
- If your floats are based on radians, then do something like
-
- inline int AngleComp (double x)
- { const double factor = 360.0 / pi2;
- return (int)(x * factor); // use static_cast if supported
- }
-
- circle(x, y, AngleComp(start), AngleComp(end));
- circle(x, y, (int)(strt * pi2
-
- --
- Pete Grant
- Kalevi, Inc.
- Object Oriented Software Development
-